//
//  KYZXTableViewCell.m
//  KuYouZiXun
//
//  Created by lanou on 15/8/6.
//  Copyright (c) 2015年 lanou. All rights reserved.
//

#import "KYZXTableViewCell.h"

#import "UIImageView+WebCache.h"

#import "KYZXUserInfo.h"
@implementation KYZXTableViewCell



- (void)awakeFromNib {
    
    [super awakeFromNib];
    self.contentView.backgroundColor = [KYZXUserInfo standardKYZXUserInfo].backgroundColor;
    self.titleLabel.textColor = [KYZXUserInfo standardKYZXUserInfo].textColor;
    self.isImagePlay = [KYZXUserInfo standardKYZXUserInfo].isImagePlay;
   
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    
    [super setSelected:selected animated:animated];

}

- (void)setModel:(KYZXContentListModel *)model{

    _model = model;
    self.titleLabel.text = model.title;
    self.commentLabel.text = [NSString stringWithFormat:@"%@条评论",[model.commentCount stringValue]];
    if (self.isImagePlay) {
        [self.thumbImageView sd_setImageWithURL:[NSURL URLWithString:model.thumbnailUrl] placeholderImage:[UIImage imageNamed:@"_backimage"]];
    }
    else{
        [self.thumbImageView setImage:[UIImage imageNamed:@"_backimage"]];
    }
    
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
    self.contentView.backgroundColor = [KYZXUserInfo standardKYZXUserInfo].backgroundColor;
    self.titleLabel.textColor = [KYZXUserInfo standardKYZXUserInfo].textColor;
    if ([keyPath isEqualToString:@"isImagePlay"]) {
        self.isImagePlay = [KYZXUserInfo standardKYZXUserInfo].isImagePlay;
    }
}
@end
